<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H5素材搜集信息设置</title>
    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="<%=path%>/hplus/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="<%=path%>/hplus/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="<%=path%>/hplus/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="<%=path%>/hplus/css/animate.min.css" rel="stylesheet">
    
    <link href="<%=path%>/hplus/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="<%=path%>/hplus/js/plugins/sweetalert/sweetalert2.min.css">
    <link href="<%=path%>/css/marketing/s_style.css" rel="stylesheet">
    
    <link href="<%=path%>/hplus/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="<%=path%>/hplus/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
    <link href="<%=path%>/hplus/css/plugins/cropper/cropper.min.css" rel="stylesheet">
    <link href="<%=path%>/hplus/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="<%=path%>/hplus/css/plugins/jasny/jasny-bootstrap.min.css" rel="stylesheet">
    <link href="<%=path%>/hplus/css/plugins/nouslider/jquery.nouislider.css" rel="stylesheet">
    <link href="<%=path%>/hplus/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="<%=path%>/hplus/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">

    <style> 
        .radio label{
            padding-left: 0;
        }
        .col-sm-1{
                width: 9.333333%;
        }
        .s_progress_bar{
                width: 260px;
        }
        .s_x_color_bz{
                width: 260px;
			    height: 30px;
			    line-height: 30px;
			    margin-top: 20px;
			    overflow: hidden;
			    padding: 0;
			    position: absolute;
			    color: #999;
			    z-index: 99;
        }
        .s_current .s_x_color_bz {
		    color: #18a689;
		}
		
		.tishi{
            margin-top: 7px;
            
        }

        .alert{
            position:absolute;
            top: -15px;
            left: 8%;
            display:none;
        }
        .s_phone_bg{
        	background:url('<%=path%>/images/bg_phone.png') no-repeat;
        	background-size:100% 100%;
        	width:340px;
        	height:720px;
        }
        .header_bg{
			background:url(<%=path%>/images/marketing/phone_header.jpg) no-repeat;
			width: 94%;
		    height: 8%;
		    padding-top: 8%;
		    background-size: 100% 100%;
		    margin-left: 2.9%;
		    margin-top: 19.5%;
		}
		.s_bg{
			background:url(<%=path%>/images/marketing/activity_success_bg.png) no-repeat;
			background-size:100% 100%;
			width: 94%;
			margin-left: 2.9%;
		}
		div.bottom {
		  position:relative;
		  }
		.qrcode {
		  position:absolute;
		  bottom:0;
		}
		  
		.s_line {
		    height: 4px;
		    margin-bottom: 20px;
		    overflow: hidden;
		    background: #18a689;
		}  
		.s-label-info{
		    border-radius: .25em;
			background-color: #23c6c8;
	        color: #FFF;
	        padding: 5 10 5 10;
	        margin: 5px;
	    }
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="container-fluid">
		     <div class="row">
		        <!-- 步骤条 start -->
		        <!-- <div class="col-md-12"><h3><strong>创建H5图文素材</strong></h3></div> -->
		        
		        <!-- 步骤条 end -->
		        
		        <div class="ibox-content col-md-12">
			        
                    <form method="get" class="form-horizontal">
                        <div class="form-group">
                           <label class="col-sm-1 control-label"></label>
		                   <div class="col-sm-11 x_progress " style="width:900px;">
				             <div class="line">
				                <div class="s_progress_bar s_current" role="progressbar"
									 aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
									<span class="sr-only_1">1</span>
									<p class="s_x_color_bz">H5素材设置</p >
								</div>
								<div class="s_progress_bar s_current" role="progressbar"
									 aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
									<span class="sr-only_2">2</span>
									<p class="s_x_color_bz">H5素材收集信息设置</p >
								</div>
								<div class="s_progress_bar" style="background-color: #ddd;" role="progressbar"
									 aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
									<span class="sr-only_3">3</span>
									<p class="s_x_color_bz">H5素材分享设置</p >
								</div>
				             </div>
				          </div>
				        </div>  
                        <div class="form-group">
		                    <label class="col-sm-2 control-label">是否需要收集客户信息:</label>
		                    <!-- <div class="col-sm-5" style="width: 25.666667%;margin-top:2px">
		                         <h6>通过活动收集信息可以有效转化会员，并沉淀会员基础信息</h6>
		                    </div> -->
		                    <div class="col-sm-1 switch_collect" style="width: 6.333333%;">
		                      <input type="checkbox" class="js-switch_4"/>
		                    </div> 
                        </div>
	                    <div class="form-group needCollect">
		                    <label class="col-sm-1 control-label">收集信息:</label>
		                    <div class="col-sm-2" style="width: 12.666667%;">
		                        <button type="button" class="btn btn-primary" data-toggle="modal" href="<%=path%>/material/modalCollectInfo" data-target="#modalCollectInfo" data-backdrop="static" data-keyboard="false">选择收集信息字段</button>
		                    </div>
		                    <div class="tishi col-sm-6" style="position:relative;margin-left:-10px">
		                        <img src="<%=path%>/images/marketing/help.png" />
		                        <div class="col-sm-6 alert alert-success">
		                            	收集信息表单将显示在H5素材文本编辑器内容下方。(姓名手机为必填字段)
		                        </div>
		                    </div>  
                        </div>
                        <div class="form-group needCollect">
		                    <label class="col-sm-1 control-label"></label>
		                    <div class="col-sm-8" id="collectList">
                                 <span class="s-label-info">姓名<span style="color:#ddd;">(必填)</span></span>
		                         <span class="s-label-info">手机<span style="color:#ddd;">(必填)</span></span>
		                    </div>
                        </div>
                        
                        
                        <div class="form-group needCollect">
		                    <label class="col-sm-1 control-label"></label>
		                    <div class="col-md-2" style="width: 11.666667%;">
								 <h5>提交信息按钮颜色</h5>	
							</div>
							<div class="k_color col-sm-1" style="width: 6.333333%;margin-left:-10px">
                                <img src="<%=path %>/images/marketing/ha.png"> <span class="caret" data-toggle="dropdown" style="margin:8px 5px;"></span>
                                <input id="buttonSubmitColor" type="color" onchange="buttonSubmitColorOnChange()" style="opacity:0;position:absolute;top:0;width:50px;margin-left:-50px">
                            </div>
							<div class="col-md-1" style="width: 7.333333%;">
								 <h5>按钮文字</h5>	
							</div>
							<div class="col-md-2">
							     <input  id="buttonSumitText" type="text" placeholder="提交" class="form-control" style="margin-top:-5px;margin-left:-20px" maxlength="10" onblur="checkLength(this)">
							</div>
                        </div>
                        
                        <div class="form-group needCollect">
		                    <label class="col-sm-1 control-label">提表派券:</label>
		                    <div class="col-sm-1">
		                        <button id="choseCoupon" type="button" class="btn btn-primary" data-toggle="modal" href="<%=path%>/material/modalSysCoupon" data-target="#couponModal"  data-backdrop="static" data-keyboard="false">选择电子券</button>
		                    </div>
		                    <div class="tishi col-sm-6" style="position:relative;margin-left:-10px">
		                        <img src="<%=path%>/images/marketing/help.png" />
		                        <div class="col-sm-6 alert alert-success">
		                            	系统将自动为H5提交表单用户派发选择的优惠券
		                        </div>
		                    </div> 
                        </div>
                        <div class="form-group needCollect">
		                    <label class="col-sm-1 control-label"></label>
		                    <div id="couponList" class="col-sm-8">
		                    </div>
                        </div>
                        <div class="form-group needCollect">
		                    <label class="col-sm-1 control-label">派券名额:</label>
		                    <div class="col-sm-1">
		                        <input id="couponLimit" type="text" class="form-control" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}" maxlength="10">
		                    </div>
		                    <div class="col-sm-2" style="margin-left:-15px;margin-top:2px">
		                        <h6>若不填写将不限制参与名额</h6>
		                    </div>
                        </div>
                        
                        <div class="col-sm-12 needCollect">
                            <hr style="height:1px;border:none;border-top:1px dashed #dddd;" />
                        </div>
                        
                        <div class="form-group needCollect">
		                    <label class="col-sm-2 control-label" style="width: 15.666667%;">自定义提交表单成功页面</label>
		                    <div class="col-sm-1 switch_success_page" style="width: 6.333333%;">
		                      <input type="checkbox" class="switchSuccessPage"/>
		                    </div>
		                    <div class="col-sm-2" style="margin-left:-15px;margin-top:2px">
		                        <h6>点击左侧开关，启用自定义提示页面</h6>
		                    </div>
                        </div>
                    </form>
                    
                    <!-- 下半部分 start -->
                    <div class="col-sm-12 white-bg bottom needCollect">
                        <!-- 左侧 start -->
                        <div class="col-md-5">
                        
                          <div class="col-md-12 text-center" style="margin-bottom:15px">
                               <span id="defineHintPage">自定义提示页</span>&nbsp;&nbsp;&nbsp;&nbsp;
                               <span id="defaultHintPage">默认页提示页</span>
                          </div> 
                        
				          <div class="col-md-2">
				          </div>
				          <div class="col-md-8 text-center preview_border s_phone_bg" style="padding:0px">
				             <div class="header_bg">
				                 <h3 id="activityName" style="color:#ffffff">H5素材名称</h3>
				             </div>
				             <!-- 默认样式 -->
				             <img class="defaultHintPageDiv" style="margin-top:30%" src="<%=path%>/images/marketing/success_logo.png">
				             <h3 class="defaultHintPageDiv" style="margin-top:15px;color:#FF892F">提交成功</h3>
				             <h5 class="defaultHintPageDiv" style="margin-top:15px;">查看我的优惠券>></h5>
				             
				             <!-- 自定义样式 -->
				             <div class="s_bg defineHintPageDiv" style="padding:10px">
				                 <p id="successHintPreview" class="text-center" style="color:white;font-size:16px;">恭喜您成功参与本次活动</p>
				                 <div id="successExplainPreview" style="padding:20px;color:white;font-size:14px;">请点击查看优惠券按钮，并将优惠券截图保存，或关注公众号，在公众号中查看优惠券！</div>
				                 <button id="btnShowCouponList" class=" btn btn-w-m btn-white">查看优惠券</button>
				             </div>
				            <!--  <div id="recommendActivityPreview" class="col-md-12  defineHintPageDiv" style="margin-top:15px;padding:0px">
				                 <div class="col-md-12">
				                     <div class="col-md-2"></div>
					                 <div class="col-md-2 div_line" style="margin-top:12px"></div>
					                 <h4 class="col-md-4">推荐活动</h4>
					                 <div class="col-md-2 div_line" style="margin-top:12px"></div>
					                 <div class="col-md-2"></div>
				                 </div>
				                 
				                 <div class="col-md-12" style="margin-top:15px;padding:0px">
				                     <ul id="recommendActivityList">
				                       
				                     </ul>
				                 </div>
				             </div> -->
				             
				             <div id="qrcodePreview" class="col-md-12 text-center qrcode  defineHintPageDiv" style="margin-bottom:25%;margin-top:20px;">
				                  <img class="qrcodeImg" style="width:80px;height:80px" src="<%=path %>/images/marketing/icon_wb.png">
				                  <h6 id="qrcodeHintPreview">长按识别二维码 一键关注</h6>
				             </div>
				             
				          </div>
				          <div class="col-md-2">
				          </div>
				       </div>
                       <!-- 右侧 start -->
                       
                       <div class="col-md-7 needCollect">
				          <form class="form-horizontal" id="uploadPic" enctype="multipart/form-data">
				              <div class="form-group">
			                     <label class="col-sm-3 control-label">提示标题</label>
			                     <div class="col-sm-6">
			                        <input id="successHint" type="text" class="form-control" placeholder="恭喜您成功参与本次活动" maxlength="16" onblur="checkLength(this)" oninput="reloadUI()">
			                     </div>
			                  </div>
			                  <div class="form-group">
			                     <label class="col-sm-3 control-label">提示说明区</label>
			                     <div class="col-sm-6">                      
			                        <textarea id="successExplain" name="comment" class="form-control" placeholder="请点击查看优惠券按钮，并将优惠券截图保存，或关注公众号，在公众号中查看优惠券" required="" aria-required="true" style="height:100px" oninput="reloadUI()" maxlength="200"></textarea>                       
			                     </div>
				              </div>
				              <div class="form-group" hidden>
			                     <label class="col-sm-3 control-label">提示区高度</label>
			                     <div class="col-sm-6">
			                        <input id="successHintHeight" type="text" class="form-control" placeholder=""onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}" maxlength="3" oninput="reloadUI()">
			                     </div>
			                  </div>
				              
				              
				              <div class="form-group">
		                         <label class="col-sm-3 control-label">上传背景图</label>
			                     <div class="col-md-4">  
			                        <div class="x_img_sc"><img id="backgroundPic" src="<%=path %>/images/marketing/img_p.png" height="100px" width="100px"></div>    
			                     </div>
				              </div> 
				              <div class="form-group">
		                         <label class="col-sm-3 control-label"></label>
			                     <div class="col-sm-3" style="width:20%">  
			                        <button type="button" class="btn btn-primary col-sm-12">选择图片</button>
			                        <input class="col-md-12 backgroundPic" accept="image/gif,image/jpeg,image/x-png"
														type="file" 
														onchange="uploadImage(1)" name="filepath1"
														style="filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0; position: absolute; z-index: 99;margin-top:4px;margin-left: -10px;">
			                        
			                     </div>
			                     <h6>请上传<3M的图片，建议尺寸宽750</h6>
				              </div> 
				              
				              <div class="form-group">
			                     <label class="col-sm-3 control-label">查看优惠券按钮</label>
								  <div class="checkbox i-checks"><label><input id="isShowCouponBtn" type="checkbox" ></label> 显示查看优惠券按钮</div>
	                          </div>
							  <div class="form-group">
								  <label class="col-sm-3 control-label"></label>
								  <div class="col-sm-2" style="width:12.666667%;margin-top:3px">
									  <h5>按钮文字</h5>
								  </div>
								  <div class="col-sm-2">
									  <input id="inputBtnText" type="text" placeholder="查看优惠券" class="form-control" style="margin-left:-20px" maxlength="20" onblur="checkLength(this)" oninput="reloadUI()">
								  </div>

								  <div class="col-md-1" style="width: 12.333333%;margin-top: 3px;margin-left: -30px;">
									  <h5>按钮颜色</h5>
								  </div>
								  <div class="k_color col-sm-2" style="margin-top: 4px;margin-left:-20px;width: 11%;">
									  <img src="<%=path%>/images/marketing/ha.png"> <span class="caret" data-toggle="dropdown" style="margin:8px 5px;"></span>
									  <input id="inputBtnTextColor" type="color" onchange="reloadUI()" style="opacity:0;position:absolute;top:0;width:50px;margin-left:-10px">
								  </div>

								  <div class="col-md-1" style="width: 12.333333%;margin-top: 3px;margin-left: -25px;">
									  <h5>文本颜色</h5>
								  </div>
								  <div class="k_color col-sm-2" style="margin-top: 4px;margin-left:-15px">
									  <img src="<%=path%>/images/marketing/ha.png"> <span class="caret" data-toggle="dropdown" style="margin:8px 5px;"></span>
									  <input id="buttonCouponTextColor" type="color" onchange="reloadUI()" style="opacity:0;position:absolute;top:0;width:50px;margin-left:-50px">
								  </div>
							  </div>
				              
				              <div class="form-group">
			                     <label class="col-sm-3 control-label">页脚设置</label>
			                     <div class="checkbox i-checks"><label><input id="isShowQrcode" type="checkbox" ></label> 显示二维码</div>
			                  </div>
			                  <div class="form-group">
		                         <label class="col-sm-3 control-label"></label>
			                     <div class="col-md-4">  
			                        <div class="x_img_sc"><img id="card_image" class="qrcodeImg" src="<%=path %>/images/marketing/img_p.png" height="100px" width="100px"></div>    
			                     </div>
				              </div> 
			                  
				              <div class="form-group">
		                         <label class="col-sm-3 control-label"></label>
			                     <div class="col-md-3" style="width:20%">  
			                        <button type="button" class="btn btn-primary col-sm-12">选择图片</button>
			                        <input class="col-md-12 qrcodeImg" accept="image/gif,image/jpeg,image/x-png"
														type="file" 
														onchange="uploadImage(2)" name="filepath2" 
														style="filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0; position: absolute; z-index: 99;margin-top:4px;margin-left: -10px;">
			                        
			                     </div>
			                     <h6>请上传<3M的图片，建议尺寸宽180*180</h6>
				              </div> 
				              
				              <div class="form-group">
		                         <label class="col-sm-3 control-label"></label>
		                         <span class="col-sm-2" style="width: 15.666667%;margin-top: 10px;">说明文字</span>
			                     <div class="col-md-4">  
			                        <input id="qrcodeText" type="text" class="form-control" maxlength="16" onblur="checkLength(this)" oninput="reloadUI()" placeholder="长按识别二维码 一键关注">
			                     </div>
				              </div> 
			                  <!-- <div class="form-group">
			                     <div class="checkbox i-checks col-md-4">
		                             <label class="pull-right"><div class="icheckbox_square-green" style="position: relative;"><input id="recommendBox" type="checkbox" value="" style="position: absolute; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins></div>推荐活动</label>
		                         </div>
			                     <div class="panel panel-default col-md-6" style="width:45.5%;margin-left:15px;min-height:60px">
									<div class="panel-body">
										<ul id="recommendlist">
											
										</ul>
									</div>
							     </div>
			                     <a id="choseRecommendActivity" style="margin-top:40px;"><font color="#1ab394">选择推荐</font></a>
				              </div> -->
				          </form>
				       </div>
					   
                    </div>
                     <div class ="col-sm-12 text-center" style="margin-top: 30px;margin-bottom: 15px">
                       <!--  <button hidden id="preview" type="button" class="btn btn-outline btn-primary needCollect" style="margin-right:15px"  onclick="javascript:previewMaterial();">预览</button>
                        <button hidden="" type="button" class="btn btn-outline btn-primary needCollect" style="margin-right:15px" onclick="javascript:save();">保存</button>
 -->                        <button type="button" class="btn btn-outline btn-primary" style="margin-right:15px" id="lastStep">上一步</button>
                        <button type="button" class="btn btn-primary" id="next">下一步</button>
                     </div>
                </div>    
		     </div>
		</div>     
    </div>
    
    <div class="modal inmodal fade" id="couponModal" tabindex="-1" role="dialog"  aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
               
            </div>
        </div>
    </div>
    
    <div class="modal inmodal fade" id="modalCollectInfo" tabindex="-1" role="dialog"  aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
               
            </div>
        </div>
    </div>
         <!-- 立刻分享弹框 -->
   <div hidden="" class="modal inmodal fade" id="shareModal" tabindex="-1" role="dialog"  aria-hidden="true">
	    <div class="modal-dialog modal-sm">
	        <div class="modal-content">
	            <div class="modal-header">
	                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
	                <h4 class="modal-title">预览</h4>
	            </div>
	            <div class="modal-body text-center">
	               <div id="qrcode"></div>
	            </div>
	        </div>
	    </div>
	</div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="<%=path%>/hplus/js/plugins/sweetalert/sweetalert2.min.js"></script>
    <script type="text/javascript" src="<%=path%>/js/marketing/dialog.js"></script>
	<script type="text/javascript" src="<%=path%>/js/marketing/public.js"></script>
	<script type="text/javascript" src="<%=path%>/js/marketing/lengthlimit.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.2.2/jquery.form.min.js"></script>
	<script src="<%=path%>/hplus/js/plugins/chosen/chosen.jquery.js"></script>
    <script src="<%=path%>/hplus/js/plugins/jsKnob/jquery.knob.js"></script>
    <script src="<%=path%>/hplus/js/plugins/jasny/jasny-bootstrap.min.js"></script>
    <script src="<%=path%>/hplus/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="<%=path%>/hplus/js/plugins/prettyfile/bootstrap-prettyfile.js"></script>
    <script src="<%=path%>/hplus/js/plugins/nouslider/jquery.nouislider.min.js"></script>
    <script src="<%=path%>/hplus/js/plugins/switchery/switchery.js"></script>
    <script src="<%=path%>/hplus/js/plugins/ionRangeSlider/ion.rangeSlider.min.js"></script>
    <script src="<%=path%>/hplus/js/plugins/iCheck/icheck.min.js"></script>
    <script src="<%=path%>/hplus/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="<%=path%>/hplus/js/plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
    <script src="<%=path%>/hplus/js/plugins/clockpicker/clockpicker.js"></script>
    <script src="<%=path%>/hplus/js/plugins/cropper/cropper.min.js"></script>
    <script src="<%=path%>/hplus/js/demo/form-advanced-demo.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/artDialog/7.0.0/dialog-plus.js"></script>
	<script type="text/javascript">
	
	    var couponIdArray=new Array();
	    var couponNameArray=new Array();
	    var fieldIdArray = new Array();
	    var showDefineHint=false;
	    var materialName="";
	    var materialId="";
	    var handleType="";
	    
	    var id=0;
	    var copyId=0;
	    var title="恭喜您成功参与本次活动";
	    var tipText="请点击查看优惠券按钮，并将优惠券截图保存，或关注公众号，在公众号中查看优惠券";
	    var tipHeight="";
	    var backPic="";
	    var buttonCouponColor="";
	    var buttonCouponText="查看优惠券";
	    var buttonCouponTextColor="";
	    var isShowQrcode=1;
	    var isShowCouponBtn = 1;
	    var qrcodePic="";
	    var qrcodeText="长按识别二维码 一键关注";
	    var successPageId=0;
	    var name="";

	    var fieldIds="";
	    var buttonSubmitColor="";
	    var buttonSumitText="提交";
	    var couponIds="";
	    var couponLimit=0;
	    var isCreate=false; //创建标记
	    var isNeedCollect=0;//是否需要收集信息
	    var materialType=1;
	    var successPageSwitchery;
	    var collectInfoSwitchery;
	    var handleAction = "";
	    var previewId;
	    var status = 0;
	    var path=window.parent.servicePath;
	    
	    var startTime = null;
	    var endTime = null;
	    var validityType = 0;
	    $(function(){
	    	$('.tishi img').mouseover(function(){
                $(this).parent().find('.alert').show();
            });
            $('.tishi img').mouseout(function(){
                $(this).parent().find('.alert').hide();
            });
	    	$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});
	    	$('.defaultHintPageDiv').show();
	    	$('.defineHintPageDiv').hide();
	    	$('#defaultHintPage').css({"color":"#18a689"}); 
			$('#defineHintPage').css({"color":"#676a6c"}); 
			handleType=getQueryString("handleType"); 
			id=getQueryString("id"); 
			copyId=getQueryString("copyId"); 
			previewId = getQueryString("previewId"); 
			materialType = getQueryString("materialType"); 
			successPageSwitchery = new Switchery(document.querySelector(".switchSuccessPage"),{
	            color: "#1AB394"
	        });
			collectInfoSwitchery = new Switchery(document.querySelector(".js-switch_4"),{
	            color: "#1AB394"
	        });
			$(".needCollect").hide();
			if(handleType == "edit"){
				isCreate=true;
				getMaterialInfo(id);
			}else if(handleType == "copy"){
				getMaterialInfo(copyId);
			}else{
				getMaterialInfo(id);
				initCollectInfo();
			}
			
			
	    })
	    
	    /* 初始化收集信息 */
	    function initCollectInfo(){
	    	var collectObj=new Object();
    		collectObj.fieldName="姓名";
    		collectObj.required="1";
    		var collectObj2=new Object();
    		collectObj2.fieldName="手机";
    		collectObj2.required="1";
    		collectObj2.needVerify="1";
    		fieldIdArray.push(collectObj);
    		fieldIdArray.push(collectObj2);
    		$('.switch_success_page').click();
    		setSwitchery(successPageSwitchery, true);
	    }
	    
	    /* 获取素材内容 */
	    function getMaterialInfo(id){
	    	var url="<%=path%>/material/ajaxGetMaterialDetail";
	    	$.post(url, {
	            "id": id,
	        }, function (data) {
	            if (data.status == "200") {
	            	var materialInfo = data.data;
	            	successPageId=materialInfo.successPageId;
	            	isNeedCollect=materialInfo.isNeedCollect;
	            	couponIds=materialInfo.couponIds;
	            	materialType=materialInfo.materialType;
	            	status = materialInfo.status;
	            	startTime = materialInfo.startTime;
	            	endTime = materialInfo.endTime;
	            	validityType = materialInfo.validityType;
	            	if(status !=0 && handleType != "copy"){
	            		$("#choseCoupon").attr("disabled","false");
	            	}
	            	$('#buttonSumitText').val(materialInfo.buttonSumitText);
	            	if(StringEmpty(materialInfo.couponLimit) && materialInfo.couponLimit!=0){
	            		$('#couponLimit').val(materialInfo.couponLimit);
	            	}
	            	$('#buttonSubmitColor').val(materialInfo.buttonSubmitColor);
	            	if(isNeedCollect==1){
	            		 setSwitchery(collectInfoSwitchery, true);
	            		 getCouponList(couponIds);
		            	 getCollectInfo(id);
		            	 $(".needCollect").show();
		            	 if(successPageId == 0){
		            		 showDefineHint=false;
		            		 setSwitchery(successPageSwitchery, false);
		            		 $('.defaultHintPageDiv').show();
		    			     $('.defineHintPageDiv').hide();
		    			     $('#defaultHintPage').css({"color":"#18a689"}); 
		    				 $('#defineHintPage').css({"color":"#676a6c"}); 
		            	 }else{
		            		 $('#defineHintPage').css({"color":"#18a689"}); 
		    				 $('#defaultHintPage').css({"color":"#676a6c"}); 
		            		 showDefineHint=true;
		            		 setSwitchery(successPageSwitchery, true);
		            		 $('.defaultHintPageDiv').hide();
		    			     $('.defineHintPageDiv').show();
		    			     getSuccessPageInfo();
		            	 }
		   			 }else{
		   				setSwitchery(collectInfoSwitchery, false);
		   				$(".needCollect").hide();
		   			 }
	            } else {
	            	errorDialog(data.message);
	            }
	        });
	    }
	    /* 获取优惠券列表 */
	    function getCouponList(couponIds){
	    	if(!StringEmpty(couponIds)){
	    		return ;
	    	}
	    	var url="<%=path%>/couponDefinedTemplate/ajaxCouponModelListByIds";
	    	$.post(url, {
	            "ids": couponIds,
	        }, function (data) {
	            if (data.status == "200") {
	            	var couponDatas= data.data;
	            	var html = '';
	            	for(var i in couponDatas){
	            		var couponId = couponDatas[i].id;
	            		var couponName = couponDatas[i].name;
	            		couponIdArray.push(couponId);
	            		couponNameArray.push(couponName);
	            		html += '<span id="couponLine'+couponId+'" class="s-label-info" style="margin-right: 5px;">'+couponName+'<span class="deleteStore" couponName="'+couponName+'" couponId="'+couponId+'" style="cursor: pointer;"> ×</span></span>';
	            	}
	      	        $('#couponList').html(html);
	            } else {
	            	console.log("未选择优惠券");
	            }
	        });
	    }
	    
	    /* 获取成功提示页内容 */
	    function getSuccessPageInfo(){
	    	var url="<%=path%>/material/ajaxGetMaterialSuccessPageDetail";
	    	$.post(url, {
	            "id": successPageId,
	        }, function (data) {
	            if (data.status == "200") {
	            	setSuccessPageView(data.data);
	            } else {
	            	console.log("getSuccessPageInfo--->"+data.message);
	            }
	        });
	    }
	    /* 设置成功提示页页面ui */
	    function setSuccessPageView(data){
	    	title=data.title;
	    	tipText=data.tipText;
	    	tipHeight=data.tipHeight;
	    	buttonCouponText=data.buttonCouponText;
	    	buttonCouponColor=data.buttonCouponColor;
	    	buttonCouponTextColor = data.buttonCouponTextColor;
	    	qrcodeText=data.qrcodeText;
	    	backPic=data.backPic;
	    	qrcodePic=data.qrcodePic;
	    	isShowQrcode=data.isShowQrcode;
            isShowCouponBtn = data.isShowCouponBtn;
	    	tipText = replaceAll(tipText,"<br>","\n");
	    	$('#successHint').val(title);
	    	$('#successExplain').val(tipText);
	    	$('#successHintHeight').val(tipHeight);
	    	$('#inputBtnText').val(buttonCouponText);
	    	$('#inputBtnTextColor').val(buttonCouponColor);
	    	$('#buttonCouponTextColor').val(buttonCouponTextColor);
	    	$('#qrcodeText').val(qrcodeText);
	    	
	    	if(StringEmpty(backPic)){
	    		$(".s_bg").css("background-image", "url(" + backPic + ")");
	        	$('#backgroundPic').attr("src",backPic);
	    	}
            //判断是否显示二维码
            if(isShowQrcode==1){
	        	$("#isShowQrcode").attr("checked","checked"); 
	   		    $("#isShowQrcode").parent().addClass("checked");
	   		    $('#qrcodePreview').show();
            }else{
            	$('#qrcodePreview').hide();
            }
            // 判断是否显示查看优惠券按钮
            if(isShowCouponBtn == 1){
                $("#isShowCouponBtn").attr("checked","checked");
                $("#isShowCouponBtn").parent().addClass("checked");
			}
            if(StringEmpty(qrcodePic)){
            	$('.qrcodeImg').attr("src",qrcodePic);
	    	}
            reloadUI();
          //设置默认错误图片
			imageLoadError();
	    }
	    //保存
	    function save(){
	    	if(isNeedCollect == 1){
	    		if(showDefineHint){
	    			if(StringEmpty($('#successHint').val())){
	    				title = $('#successHint').val()
	    			}else{
	    				title = "恭喜您成功参与本次活动";
	    			}
	    	    	//tipText=$('#successExplain').val();
	    	    	tipHeight=$('#successHintHeight').val();
	    	    	if(StringEmpty($('#inputBtnText').val())){
	    	    		buttonCouponText=$('#inputBtnText').val();
	    	    	}
	    	    	
	    	    	/* buttonCouponColor=$('#inputBtnTextColor').val(); */
	    	    	if(StringEmpty($('#qrcodeText').val())){
	    	    		qrcodeText=$('#qrcodeText').val();
	    	    	}
	    	    	if(!StringEmpty(title)&&!StringEmpty(buttonCouponText)&&!StringEmpty(qrcodePic)&&!StringEmpty(qrcodeText)&&handleAction == "lastStep"){
	    	    		if(materialType==1){
	 	   				   window.location.href="<%=path%>/material/teletextMaterialCreate?handleType=edit&id="+id;
	 	   			    }else{
	 	   				   window.location.href="<%=path%>/material/photoAlbumMaterialCreate?handleType=edit&id="+id;
	 	   			    }
	    	    		return ;
	            	}
	    	    	/* if(!StringEmpty($('#buttonSumitText').val())){
		    			errorDialog("请输入收集信息提交按钮文字!");
		    			return ;
		    		}
	    	    	if(!StringEmpty(title)){
	    	    		errorDialog("请输入提示标题");
	    	    		return ;
	    	    	}
	    	    	if(isShowCouponBtn==1 && !StringEmpty(buttonCouponText)){
	    	    		errorDialog("请输入查看优惠券按钮文字");
	    	    		return ;
	    	    	} */
	    	    	if(isShowQrcode == 1){
	    	    		if(!StringEmpty(qrcodePic)){
	    	    			errorDialog("请上传二维码");
	    		    		return ;
	    	    		}
	    	    		/* if(!StringEmpty(qrcodeText)){
	    	    			errorDialog("请输入二维码说明文字");
	    		    		return ;
	    	    		} */
	    	    		
	    	    	}
		    		if(!isCreate && (handleType == "create" || handleType == "copy") || successPageId == 0){
			    		saveSuccessPageInfo();
			    	}else{
			    		editSuccessPageInfo();
			    	}
		    	}else{
		    		/* if(!StringEmpty($('#buttonSumitText').val()) && handleAction != "lastStep"){
		    			errorDialog("请输入收集信息提交按钮文字!");
		    			return ;
		    		}  */
		    		successPageId=0;
		    		saveMaterialInfo();
		    	}
	    	}else{
	    		saveMaterialInfo();
	    	}
	    	
	    }
	    
	    /* 保存素材信息 */
	    function saveMaterialInfo(){
	    	/* buttonSubmitColor = $('#buttonSubmitColor').val(); */
	    	if(StringEmpty($('#buttonSumitText').val())){
	    		buttonSumitText = $('#buttonSumitText').val();
	    	}
	    	couponLimit = $('#couponLimit').val();
	    	if(!StringEmpty(couponLimit)){
	    		couponLimit=0;
	    	}
	    	couponIds=couponIdArray.join(",");
	    	var url = "<%=path%>/material/ajaxUpdateMaterial";
	        $.post(url, {
	        	"id":id,
	        	"previewId":previewId,
	        	"isNeedCollect":isNeedCollect,
	        	"successPageId":successPageId,
	            "buttonSubmitColor": buttonSubmitColor,
	            "buttonSumitText":buttonSumitText,
	            "couponLimit": couponLimit,
	            "couponIds": couponIds,
	        }, function (data) {
	            if (data.status == "200") {
	            	saveCollectInfo();
	            } else {
	            	errorDialog(data.message);
	            }
	        });
	    }
	    /* 保存素材成功提示页内容 */
	    function saveSuccessPageInfo(){
	    	var url = "<%=path%>/material/ajaxCreateMaterialSuccessPage";
	        $.post(url, {
	        	"title": title,
	            "tipText": tipText,
	            "tipHeight":tipHeight,
	            "backPic":backPic,
	            "buttonCouponColor": buttonCouponColor,
	            "buttonCouponText": buttonCouponText,
	            "buttonCouponTextColor":buttonCouponTextColor,
	            "isShowQrcode": isShowQrcode,
	            "qrcodePic": qrcodePic,
	            "qrcodeText": qrcodeText,
				"isShowCouponBtn":isShowCouponBtn,
	        }, function (data) {
	            if (data.status == "200") {
	            	isCreate=true;
	            	successPageId=data.data;
	            	saveMaterialInfo();
	            } else {
	            	errorDialog("成功提示页内容保存失败");
	            }
	        });
	    }
	    /* 编辑成功提示页 */
	    function editSuccessPageInfo(){
	    	var url = "<%=path%>/material/ajaxUpdateMaterialSuccessPage";
	        $.post(url, {
	        	"id":successPageId,
	        	"title": title,
	            "tipText": tipText,
	            "tipHeight":tipHeight,
	            "backPic":backPic,
	            "buttonCouponColor": buttonCouponColor,
	            "buttonCouponText": buttonCouponText,
	            "buttonCouponTextColor":buttonCouponTextColor,
	            "isShowQrcode": isShowQrcode,
	            "qrcodePic": qrcodePic,
	            "qrcodeText": qrcodeText,
				"isShowCouponBtn":isShowCouponBtn,
	        }, function (data) {
	            if (data.status == "200") {
	            	/* successPageId=data.id; */
	            	saveMaterialInfo();
	            } else {
	            	errorDialog("成功提示页内容保存失败");
	            }
	        });
	    }
	    /* 获取收集信息 */
	    function getCollectInfo(id){
	    	var url="<%=path%>/material/ajaxListCollectField";
	    	$.post(url, {
	            "mgiId": id,
	        }, function (data) {
	            if (data.status == "200") {
	            	fieldIdArray.length=0;
	            	var collectFieldData = data.data;
	            	var html='<span class="s-label-info">姓名<span style="color:#ddd;">(必填)</span></span><span class="s-label-info">手机<span style="color:#ddd;">(必填)</span></span>';
	            	var index = 0;
	            	for(var i in collectFieldData){
	            		var collectObj=new Object();
	            		var fieldName =  collectFieldData[i].fieldName;
	            		var required=  collectFieldData[i].required;
	            		collectObj.fieldName=fieldName;
	            		collectObj.required=required;
	            		if(fieldName == "手机" || fieldName == "邮箱"){
		    	    		collectObj.needVerify=collectFieldData[i].needVerify;
		    	    		if(fieldName == "邮箱"){
		    	    			html += '<span class="s-label-info">'+fieldName+'<span class="deleteCollect" index="'+index+'" style="cursor: pointer;"> ×</span></span>';
		    	    		}
		    	    	}else if(fieldName != "手机" && fieldName != "姓名"){
		    	    		html += '<span class="s-label-info">'+fieldName+'<span class="deleteCollect" index="'+index+'" style="cursor: pointer;"> ×</span></span>';
		    	    	}
	            		fieldIdArray.push(collectObj);
	        	    	index++;
	            	}
	            	$('#collectList').html(html);
	            } else{
	            	initCollectInfo();
	            }
	        });
	    }
	    /* 保存收集信息 */
	    function saveCollectInfo(mgiId){
	    	if(fieldIdArray.length == 0){
	    		if(handleAction == "next"){
	           		 window.location.href="<%=path%>/material/materialShareSetting?handleType="+handleType+"&id="+id+"&copyId="+copyId+"&previewId="+previewId;	            	
	           	}else if(handleAction == "lastStep"){
	           		if(materialType==1){
	   				   window.location.href="<%=path%>/material/teletextMaterialCreate?handleType=edit&id="+id;
	   			    }else{
	   				   window.location.href="<%=path%>/material/photoAlbumMaterialCreate?handleType=edit&id="+id;
	   			    }
	           	}else{
	           		SuccessDialogByUrl("保存成功!","",url);
	           		var url ='<%=path%>/material/materialList';
	           		setTimeout(function () { window.location.href=url; }, 1600);
	           	}     
	    	    return ;         
	    	}
	    	
	    	var url="<%=path%>/material/ajaxInsertCollectField";
	    	$.post(url, {
	            "mgiId": id,
	            "collectFields": JSON.stringify(fieldIdArray),
	        }, function (data) {
	            if (data.status == "200") {
	            	if(handleAction == "next"){
	            		 window.location.href="<%=path%>/material/materialShareSetting?handleType="+handleType+"&id="+id+"&copyId="+copyId+"&previewId="+previewId;            	
	            	}else if(handleAction == "lastStep"){
		           		if(materialType==1){
		   				   window.location.href="<%=path%>/material/teletextMaterialCreate?handleType=edit&id="+id;
		   			    }else{
		   				   window.location.href="<%=path%>/material/photoAlbumMaterialCreate?handleType=edit&id="+id;
		   			    }
			        }else{
		           		SuccessDialogByUrl("保存成功!","",url);
		           		var url ='<%=path%>/material/materialList';
		           		setTimeout(function () { window.location.href=url; }, 1600);
	            	}
	            } else {
	            	errorDialog(data.message);
	            }
	        });
	    }
    	function setSwitchery(switchElement, checkedBool) {  
            if((checkedBool && !switchElement.isChecked()) || (!checkedBool && switchElement.isChecked())) {  
                switchElement.setPosition(true);  
                switchElement.handleOnchange(true);  
            }  
        }
    	
    	
    	/* 预览 */
	    function previewMaterial(){

	        if(showDefineHint){
	        	title=$('#successHint').val();
	 	    	//tipText=$('#successExplain').val();
	 	    	tipHeight=$('#successHintHeight').val();
	 	    	buttonCouponText=$('#inputBtnText').val();
	 	    	/* buttonCouponColor=$('#inputBtnTextColor').val(); */
	 	    	qrcodeText=$('#qrcodeText').val();
	 	    	var url = "<%=path%>/material/ajaxSaveMaterialSuccessPagePreview";
	 	        $.post(url, {
	 	        	"previewId":previewId,
	 	        	"title": title,
	 	            "tipText": tipText,
	 	            "tipHeight":tipHeight,
	 	            "backPic":backPic,
	 	            "buttonCouponColor": buttonCouponColor,
	 	            "buttonCouponText": buttonCouponText,
	 	            "buttonCouponTextColor": buttonCouponTextColor,
	 	            "isShowQrcode": isShowQrcode,
	 	            "qrcodePic": qrcodePic,
	 	            "qrcodeText": qrcodeText,
                    "isShowCouponBtn":isShowCouponBtn,
	 	        }, function (data) {
	 	            if (data.status == "200") {
	 	            	var url =window.parent.servicePath+"/material/materialSuccessPagePreview?previewId="+previewId;
	 	            	showPreviewDialog(url);
	 	            } else {
	 	            	errorDialog("预览失败");
	 	            }
	 	        });
	        }else{
	            	var url =window.parent.servicePath+"/material/defaultSuccessPage";
	            	/* $('#qrcode').html('');
	            	jQuery('#qrcode').qrcode(url);
            	    $('#shareModal').modal('show'); */
	            	showPreviewDialog(url);
	        }
	       
	    }
    	
	function showPreviewDialog(url){
		 var d = dialog({
				width: 140,
	 	        height:140,
	 	        align: 'top',
	 			content:"<div id='code'></div> <img src='' id='qrcodeImg' style='width:140px;height:140px;'/>"+
	 	        "<a id='download' download='qrcode.jpg'></a>"
	 	        ,
				quickClose: true// 点击空白处快速关闭
		 });
		 d.show(document.getElementById('preview'));
		 var qrcode = $('#code').qrcode({
			   width: 110,
			   height:110,
	           text:url+""/*可以通过ajax请求动态设置*/
	    	 }).attr("style","display:none;");
	     	//将生成的二维码转换成图片格式
		  var canvas = qrcode.find('canvas').get(0);
		  $('#qrcodeImg').attr('src', canvas.toDataURL('image/jpg'));
		  $(".ui-dialog").css("background-color" , "rgba(7, 17, 27, 0.3)"); 
	}
	</script>  
	
	
	<!-- 上传图片 -->
	<script type="text/javascript">
		var flag=false;
		var picType=1;
		var typeName="";
		function uploadImage(type) {
			picType=type;
			typeName="filepath"+type;
		    $("#uploadPic").submit(function (event) {
		        if(flag){
		            return ;
		        }
		        flag=true;
		        $("#uploadPic").ajaxSubmit({
		            type: "post",
		            url: "<%=path%>/api/uploadfile/file",
		            data:{"typename":typeName},
		            success: function (data1) {
		            	if(data1.status == "200"){
		            		setPic(data1.realSavePath);
		            	}
		            },
		            error: function (msg) {
		                promptDialog("文件上传失败");
		            }
		        });
		        return false;
		    });
		    if (flag) {
	            flag = false;
	        }
		    $("#uploadPic").submit();
		}
		function setPic(picUrl){
			switch (picType) {
			case 1:
				backPic=picUrl;
		        if(StringEmpty(backPic)){
		        	$(".s_bg").css("background-image", "url(" + backPic + ")");
		        	$('#backgroundPic').attr("src",backPic);
		        }
				break;
		    case 2:
		    	qrcodePic=picUrl;
		        if(StringEmpty(qrcodePic)){
		        	$('.qrcodeImg').attr("src",qrcodePic);
		        	$("#qrcodeBox").attr("checked","checked"); 
		   		    $("#qrcodeBox").parent().addClass("checked");
		        }
				break;
			default:
				break;
			}
			//设置默认错误图片
			imageLoadError();
		}
	</script>
	
	<!-- 按钮点击事件 -->
	<script type="text/javascript">
		 $('#lastStep').click(function () {
			 handleAction = "lastStep";
			 save();
		 });
		 $('#next').click(function () {
			handleAction="next";
			save();
		 });
		 $(document).on('click', '.switch_success_page', function() {
			 if(showDefineHint){
				 showDefineHint=false;
				 $('#defaultHintPage').css({"color":"#18a689"}); 
				 $('#defineHintPage').css({"color":"#676a6c"}); 
				 $('.defaultHintPageDiv').show();
			     $('.defineHintPageDiv').hide();
			 }else{
				 $('#defineHintPage').css({"color":"#18a689"}); 
				 $('#defaultHintPage').css({"color":"#676a6c"}); 
				 $('.defaultHintPageDiv').hide();
			     $('.defineHintPageDiv').show();
				 showDefineHint=true;
				 if(isShowQrcode == 1){
					 $('#isShowQrcode').attr("checked","checked"); 
					 $('#isShowQrcode').parent().addClass("checked");
				 }
                 if(isShowCouponBtn == 1){
                     $('#isShowCouponBtn').attr("checked","checked");
                     $('#isShowCouponBtn').parent().addClass("checked");
                 }
			 }
		 });
		 
		 $(document).on('ifChecked', '#isShowQrcode', function() {
		    	$(this).attr("checked","checked"); 
				$(this).parent().addClass("checked");
				isShowQrcode=1;
				$('#qrcodePreview').show();
		  });
	     $(document).on('ifUnchecked', '#isShowQrcode', function() {
		    	$(this).removeAttr("checked","checked"); 
				$(this).parent().removeClass("checked");
				isShowQrcode=0;
				$('#qrcodePreview').hide();
	     });

         $(document).on('ifChecked', '#isShowCouponBtn', function() {
             $(this).attr("checked","checked");
             $(this).parent().addClass("checked");
             $('#btnShowCouponList').show();
             isShowCouponBtn=1;
         });
         $(document).on('ifUnchecked', '#isShowCouponBtn', function() {
             $(this).removeAttr("checked","checked");
             $(this).parent().removeClass("checked");
             $('#btnShowCouponList').hide();
             isShowCouponBtn=0;
         });



		 
		 function reloadUI(){
			 var successExplain = "";
			 if(StringEmpty($('#successHint').val())){
				 title=$('#successHint').val();
			 }
			 if(StringEmpty($('#successExplain').val())){
				 var tipTextTemp=$('#successExplain').val();
				 var tipTextSplit=tipTextTemp.split("\n");
				 for(var i in tipTextSplit){
	   			    if(StringEmpty(tipTextSplit[i])){
	   			    	successExplain=successExplain+tipTextSplit[i]+"<br>";
	   			    }
		   		 }
			 }else{
				 successExplain = "请点击查看优惠券按钮，并将优惠券截图保存，或关注公众号，在公众号中查看优惠券";
			 }
			 tipText = successExplain;
			 if(StringEmpty($('#inputBtnText').val())){
				 buttonCouponText=$('#inputBtnText').val();
			 }
			 var color=document.getElementById('inputBtnTextColor').value;
	         if(color!="#000000"){
	        	 buttonCouponColor=color;
	        	 $("#btnShowCouponList").css("background-color",buttonCouponColor);
	         }
	         
	         if($('#buttonCouponTextColor').val()!='#000000'){
	        	 buttonCouponTextColor = $('#buttonCouponTextColor').val();
	        	 $("#btnShowCouponList").css("color",buttonCouponTextColor);
	         }
	         
			 if(StringEmpty($('#successHintHeight').val())){
				 tipHeight=$('#successHintHeight').val();
				 $(".s_bg").css("height",tipHeight+"px");
			 }
			 if(StringEmpty($('#qrcodeText').val())){
				 qrcodeText=$('#qrcodeText').val();
			 }
			 $('#successHintPreview').html(title);
			 $('#successExplainPreview').html(tipText);
			 $('#btnShowCouponList').html(buttonCouponText);
			 $('#qrcodeHintPreview').html(qrcodeText);
		 }
		 
		 function buttonSubmitColorOnChange(){
			 buttonSubmitColor = $('#buttonSubmitColor').val();
		 }
		 
		 
	</script>
	<!-- 优惠券相关 -->
	<script type="text/javascript">
	   /* 优惠券确认 */
	   function determineCoupon(){
		   var html='';
	       for(var i in couponNameArray){
	    	    html += '<span id="couponLine'+couponIdArray[i]+'" class="s-label-info" style="margin-right: 5px;">'+couponNameArray[i]+'<span class="deleteStore" couponName="'+couponNameArray[i]+'" couponId="'+couponIdArray[i]+'" style="cursor: pointer;"> ×</span></span>';
	       } 
	       $('#couponList').html(html);
	       $('#couponModal').modal('hide');
	   }
	   /* 关闭优惠券 */
	   function colseCouponModal(){
		   $('#couponModal').modal('hide');
	   }
	   
	 //打叉移除选择的门店
       $(document).on('click','.deleteStore',function(){
    	   if(status !=0 && handleType != "copy"){
    		   return ;
    	   }else{
    		var couponId=$(this).attr("couponId");
   	       	var couponName=$(this).attr("couponName");
   	       	var lineId="#couponLine"+couponId;
   	       	$(lineId).remove();
   	       	couponIdArray.splice(contains(couponIdArray,couponId), 1);
   	       	couponNameArray.splice(contains(couponNameArray,couponName), 1);
    	   }
	       	
       }); 
	</script>  
	
	<!-- 收集字段 -->
	<script type="text/javascript">
		$(document).on('click', '.switch_collect', function() {
			 if(isNeedCollect==1){
				 isNeedCollect=0;
				 $(".needCollect").hide();
			 }else{
				 isNeedCollect=1;
				 $(".needCollect").show();
			 }
		});
		function colseModalCollect(){
			   $('#modalCollectInfo').modal('hide');
		}
		$(document).on('click','.deleteCollect',function(){
			var arraySize = fieldIdArray.length;
			var index=$(this).attr("index");
	       	$(this).parent().remove();
	       	while(fieldIdArray.splice(index,1).length == 0){
	       		index--;
	       	}
	    }); 
		
		$("#modalCollectInfo").on("hidden.bs.modal", function() {
		      $(this).removeData("bs.modal");
		      $('#modalCollectInfo .modal-content').empty();
		  });
		
	    $("#couponModal").on("hidden.bs.modal", function() {
		      $(this).removeData("bs.modal");
		      $('#couponModal .modal-content').empty();
		}); 
	    
	    $(document).on('ifChecked', '.select_one', function() { 
	       	$(this).attr("checked","checked"); 
	    	$(this).parent().addClass("checked");
	    	if(couponIdArray.length == 10){
	    		errorDialog("最多只能选择10张电子券！");
	    		return ;
	    	}
	    	var couponName=$(this).attr('couponName');
	    	couponIdArray.push(this.id);
	    	couponNameArray.push(couponName);
	    });
	    $(document).on('ifUnchecked', '.select_one', function() { 
	    	$(this).removeAttr("checked","checked"); 
	    	$(this).parent().removeClass("checked");
	    	var couponName=$(this).attr('couponName');
	    	couponIdArray.splice(contains(couponIdArray,this.id), 1);
	    	couponNameArray.splice(contains(couponNameArray,couponName), 1);
	    });
	</script>
</body>
</html>
